import request from './http.interceptor'

export default {
  install: (Vue) => {
    Vue.prototype.$apis = {
      // 获取配置信息
      getConfigInfo: (params) => request.get('/dapp/config', params),

      // 获取用户信息
      getUserInfo: (params) => request.get('/dapp/user', params),

      // 保存注册记录
      saveRegisterRecord: (params) =>
        request.post('/dapp/user/register', params),

      // 保存释放记录（领取）
      saveReleaseInfo: (params) => request.post('/dapp/user/withdraw', params),

      // 保存私募记录（兑换）
      savePresaleInfo: (params) => request.post('/dapp/user/exchange', params),

      // 获取释放签名
      getReleaseSign: (params) =>
        request.get(`${process.env.VUE_APP_API_URL}/node/dapp/sign`, params),

      // 获取用户是否正在提现中
      checkUserIsWithdrawing: (params) =>
        request.get('/dapp/user/isWithdraw', params),
    }
  },
}
